package org.lex.swing.fontchooser.advanced;

import java.awt.font.TextAttribute;

public enum AdvancedFontAttribute {
	// FAMILY(TextAttribute.FAMILY),
	WEIGHT(TextAttribute.WEIGHT, Number.class), // Number
	WIDTH(TextAttribute.WIDTH, Number.class), // Number
	POSTURE(TextAttribute.POSTURE, Number.class), // Number
	SIZE(TextAttribute.SIZE, Number.class), // Number
	// TRANSFORM(TextAttribute.TRANSFORM), //TransformAttribute
	SUPERSCRIPT(TextAttribute.SUPERSCRIPT, Integer.class), // Integer
	// CHAR_REPLACEMENT(TextAttribute.CHAR_REPLACEMENT), //GraphicAttribute
	// FOREGROUND(TextAttribute.FOREGROUND), //Paint
	// BACKGROUND(TextAttribute.BACKGROUND), //Paint
	UNDERLINE(TextAttribute.UNDERLINE, Integer.class), // Integer
	STRIKETHROUGH(TextAttribute.STRIKETHROUGH, Boolean.class), // Boolean
	RUN_DIRECTION(TextAttribute.RUN_DIRECTION, Boolean.class), // Boolean
	BIDI_EMBEDDING(TextAttribute.BIDI_EMBEDDING, Integer.class), // Integer
	JUSTIFICATION(TextAttribute.JUSTIFICATION, Number.class), // Number
	// INPUT_METHOD_HIGHLIGHT(TextAttribute.INPUT_METHOD_HIGHLIGHT),
	// INPUT_METHOD_UNDERLINE(TextAttribute.INPUT_METHOD_UNDERLINE),
	SWAP_COLORS(TextAttribute.SWAP_COLORS, Boolean.class), // Boolean
	// NUMERIC_SHAPING(TextAttribute.NUMERIC_SHAPING),
	KERNING(TextAttribute.KERNING, Integer.class), // Integer
	LIGATURES(TextAttribute.LIGATURES, Integer.class), // Integer
	TRACKING(TextAttribute.TRACKING, Number.class); // Number

	public static AdvancedFontAttribute parseFromDiaplayName(String name) {
		AdvancedFontAttribute[] all = AdvancedFontAttribute.values();
		for (AdvancedFontAttribute afa : all)
			if (afa.getDiaplayName().equals(name))
				return afa;
		return null;
	}

	public TextAttribute getAttribute() {
		return this.attribute;
	}

	public String getDiaplayName() {
		return this.name();
	}

	// for renderering
	public Class<?> getValueClass() {
		return valueClass;
	}

	private TextAttribute attribute = null;
	private Class<?> valueClass = null;

	private AdvancedFontAttribute(TextAttribute attribute, Class<?> valueClass) {
		this.attribute = attribute;
		this.valueClass = valueClass;
	}
}